{% extends "orgs/base.html" %}

{% load i18n %}
{% load avatar_tags %}
{% load wiki %}
{% load wikiurl %}
{% load threadedcommentstags %}
{% load pagination_tags %}
{% load shorttimesince_tag %}
{% load extra_tagging_tags %}
{% load tagging_tags %}
{% load attachment_tags %}
{% load attachment_inclusion_tag %}


{% block head_title %}{{ org }}{% endblock %}

{% block body %}
    
    <h1 style="text-align: center;" >{{ org }} Home Page</h1>



    <div style="float: left;">
		

		<h3 style="margin-bottom: 0;" >Upcoming meetings and events:</h3>
	
		{% if all_upcoming %}
		
			{% if is_officer %}
					<a href="{% url org_meetings org_slug=org.slug %}">view all Meetings or add Meeting...</a> 
					<a href="{% url org_events org_slug=org.slug %}">view all Circle Events or add Event...</a>
			{% else %}
					<a href="{% url org_meetings org_slug=org.slug %}">view all Meetings...</a> 
					<a href="{% url org_events org_slug=org.slug %}">view all Circle Events...</a>
			{%endif %}
	
			<table class="bordered-table" >
				<tr>
					<th>Details</th>
					<th>Date and Time</th>
					<th>Description</th>
					<th>Location</th>
				</tr>    
				{% for meeting in all_upcoming %}
					<tr class="{% cycle odd,even %}">
						<td>
							{% if meeting.content_type %}
								<a href="{% url circle_event event_id=meeting.id %}">View</a>
							{% else %}
								<a href="{% url meeting_details meeting_slug=meeting.slug %}">View</a>
							{% endif %}
						</td>
						<td>{{ meeting.start_date|date:"l, d M, Y" }} at {{ meeting.start_time|time:"P" }}</td>
						<td>{{ meeting.common_description }}</td>
						<td>{{ meeting.location }}</td>
					</tr>
				{% endfor %}
			</table>
		
		{% else %}
			No upcoming meetings or events. 
			{% if is_officer %}
				<a href="{% url org_meetings org.slug %}" >Add Meeting</a>
				</br >
				<a href="{% url org_events org_slug=org.slug %}">Add Circle Event</a>
			{% endif %}
		{% endif %}
		
	{% comment %}
		
		<h2>Aims</h2>
		
		{% if aims %}
		
			{% if is_officer %}
				<p><a href="{% url org_aims org.slug %}" method="Post">view all Aims or add Aim...</a></p>
			{% else %}
				<p><a href="{% url org_aims org.slug %}" method="Post">view all Aims...</a></p>
			{%endif %}

			<table class="bordered-table">
				<tr>
					<th>Aim</th>
					<th>Modified</th>
					<th>Leader</th>
					<th>Doer</th>
					<th>Evaluator</th>
				</tr>
				{% for aim in aims %}
					<tr class="{% cycle odd,even %}" >
						<td><a href="{{ aim.get_absolute_url }}">{{ aim.name }}</a></td>
						<td>{{ aim.modified|shorttimesince }} ago</td>
						<td>
							{% if aim.leader %}
								{{ aim.leader }}
							{% else %}
								<span class="warning">No leader</span>
							{% endif %}
						</td>
						<td>
							{% if aim.doer %}
								{{ aim.doer }}
							{% else %}
								<span class="warning">No doer</span>
							{% endif %}
						</td>
						<td>
							{% if aim.evaluator %}
								{{ aim.evaluator }}
							{% else %}
								<span class="warning">No evaluator</span>
							{% endif %}
						</td>
					</tr>
				{% endfor %}
			</table>
		{% else %}
			None yet. 
			{% if is_officer %}
				<a href="{% url org_aims org.slug %}" method="Post">Add Aims</a>
			{% endif %}
		{% endif %}
		
	
		<h2>Tasks{% if total_tasks %} ({{ total_tasks }}){% endif %}</h2>

		{% if tasks %}
			{% if is_officer %}
				<p><a href="{% url org_tasks org.slug %}" method="Post">view more details or add Task...</a></p>
			{% else %}
				<p><a href="{% url org_tasks org.slug %}" method="Post">view more details...</a></p>
			{%endif %}
			
			<table class="bordered-table">
				<tr>
					<th>Task</th>
					<th>Modified</th>
					<th>Status</th>
				</tr>
				{% for task in tasks %}
					<tr class="task_{{ task.get_state_display }} {% cycle odd,even %}">
						<td><a href="{% url org_task task.id %}">{{ task.summary }}</a></td>
						<td>{{ task.modified|shorttimesince }} ago</td>
						<td>{{ task.status }}</td>
					</tr>
				{% endfor %}
			</table>
		{% else %}
			None yet. 
			{% if is_officer %}
				<a href="{% url org_tasks org.slug %}" method="Post">Add tasks</a>
			{% endif %}
		{% endif %}

			
		<h2>Wiki Articles{% if total_articles %} ({{ total_articles }}){% endif %}</h2>

		{% if articles %}
			<table class="topics">
				{% for article in articles %}
					{% show_teaser article %}
				{% endfor %}
			</table>
			<p><a href="{% wikiurl list org %}">more...</a></p>
		{% else %}
			{% wikiurl list org as wiki_url %}
			<p>
				None yet. 
				{% if is_member %}
					Go to the <a href="{{ wiki_url }}" title="wiki">wiki</a> to start a new article.
				{% endif %}
			</p>
		{% endif %}
		
	{% endcomment %}
		
	</div>

	<br />
	<div style="float: left; margin-left: 2em;" >
		
		{% comment %}
		<h3>Tag Cloud</h3>
		<div class="tag-cloud">
			{% tag_cloud_for_model wiki.Article as tags with steps=6 min_count=1 distribution=log %}
			{% for tag in tags %}
				<span class="tag-{{tag.font_size}}"><a href="/tags/{{tag.name|slugify}}/">{{tag.name}}</a></span> 
			{% endfor %}
		</div>
		{% endcomment %}
		
		<div class="members">
			<h2>{% trans "Membership" %}</h2>
			
			<table>
				{% for member in members %}
					<tr>
						<td style="padding-top: 6px; ">
							<a href="{% url profiles.views.profile member.user.username %}" title="{{ member.user_name }}">{{ member.user_name }}</a>
						</td>
						<td style="padding-left: 4px; padding-top: 6px; " >
							{{ member.get_role_display }}
						</td>
					</tr>
					{% if member.type %}
						<tr>
							<td colspan="2" >
								{{ member.get_type_display }} of {{ member.related_circle }}
							</td>
						</tr>
					{% endif %}
				{% endfor %}
			</table>
		</div>
				
	</div>

	<div style="clear: both; padding-top: 1em; " >
		<hr />
		{% attachments org %}
	</div>
    
{% endblock %}